<?php
/**
 * 分类管理
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-6-17
 * Time: 下午2:37
 */
namespace app\modules\cn\controllers;

use app\libs\IeltsController;
use app\libs\Method;
use app\modules\cn\models\Info;
use app\modules\content\models\Active;
use app\modules\content\models\Banner;
use app\modules\content\models\Calendar;
use app\modules\content\models\Classes;
use app\modules\content\models\Recommend;

class CityController extends IeltsController
{
    public $enableCsrfValidation = false;
    public $layout = 'cn';


    public function actionIndex()
    {
        $city = json_decode(file_get_contents('http://www.thinkwithu.com/cn/api/city'), true);
        $time = time();
        $recommend = Info::find()->asArray()->where('cate=2 and pushTime<=' . $time)->orderBy('sort asc,id desc')->limit(4)->all();
        $examInfo = Info::find()->asArray()->where('cate=4 and pushTime<=' . $time)->orderBy('sort asc,id desc')->limit(3)->all();
        $course = Classes::find()->asArray()->limit(2)->orderBy('viewCount desc')->all();
        $focus = Recommend::find()->asArray()->where('type=2')->orderBy('sort asc,id desc')->limit(6)->all();
        $this->title = '申友雅思在线_校区查询';
        $this->keywords = '雅思培训,雅思一对一';
        $this->description = '申友雅思提供雅思课程培训，备考资料，雅思考试，满足考生各阶段备考需求，只为雅思提分，申友雅思在线';
        return $this->render('index', ['city' => $city, 'recommend' => $recommend, 'course' => $course, 'focus' => $focus, 'examInfo' => $examInfo]);
    }

}